//
//  UIColor+Extension.swift
//  FSLText
//
//  Created by 我演示 on 2019/11/3.
//  Copyright © 2019 ALLSall. All rights reserved.
//

import Foundation
import UIKit

extension UIColor {
    
    class  func getRGBDelta (firstColor : UIColor , secondColor: UIColor ) -> (CGFloat , CGFloat , CGFloat) {
   
        let firstRGB = firstColor.getRGB()
        let secondRGB = secondColor.getRGB()

        return (firstRGB.0 - secondRGB.0 , firstRGB.1 - secondRGB.1 , firstRGB.2 - secondRGB.2)
        
    }
    
    func getRGB() -> (CGFloat , CGFloat ,CGFloat ) {
        guard let cmps =  cgColor.components  else {
            fatalError("信息使用错误")
        }
        
        return (cmps[0] * 255 , cmps[1] * 255 , cmps[2] * 255)
    }
    
}

